@main-color: #33B5E5;
@main-color-active: #0099CC;

// TODO : Not parametrized colors: smartphone actionbar, important buttons, login background

@import "_mixins.less";
@import "_jquery.toastmessage.less";
@import "_general.less";

// Default password warning
#default-password {
	display: none;
  position: fixed;
  top: 20px;
  left: 50%;
  width: 600px;
  margin-left: -300px;
  text-align: center;
  background: #e14e34;
  border: 1px solid #622117;
  .border-radius(3px);
  color: #fff;
  font-weight: bold;
  z-index: 999; // Just below #loader-page
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  padding: 10px;
  
  .dismiss {
    cursor: pointer;
    text-decoration: underline;
  }
}

// Loader
#loader-page {
	position: fixed;
  z-index: 999; // Just below #login-page
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: #fff;
  
  .loader {
		position: absolute;
		top: 50%;
    left: 50%;
		margin-left: -16px;
		margin-top: -16px;
  }
}

// Login
#login-page {
  display: none;
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: #50c0e9;
  
  form {
    position: absolute;
    left: 50%;
    top: 50%;
    display: block;
    width: 400px;
    margin-left: -200px;
    height: 200px;
    margin-top: -100px;
    text-align: center;
  }
  
  input {
    margin: 5px 0;
  }
  
  input[type="text"], input[type="password"] {
    width: 200px;
    .border-radius(4px);
  }
  
  input[type="submit"] {
    width: 100px;
  }
  
  label span {
    color: #fff;
  }
  
  #default-password-info {
    display: none;
    color: #fff;
  }
}

// Subscriptions
#subscriptions {
  .close-button {
    display: none;
  }

  .input-container {
    width: 100%;
    text-align: center;
    
    input {
      margin: 20px auto;
    }
  }
  
  h1 {
    font-weight: 300;
    font-size: 14px;
    color: #888;
    border-top: 1px solid #999;
    border-bottom: 1px solid #999;
    background: #eee;
    padding: 6px;
    padding-left: 20px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    
    &:hover {
      #category-add-button, #subscription-unread-button {
        display: inline-block;
      }
    }
    
    #category-add-button, #subscription-unread-button {
      position: absolute;
      display: none;
      right: 10px;
      top: 3px;
      cursor: pointer;
    }
    
    #subscription-unread-button {
      width: 24px;
      height: 24px;
      right: 34px;
      background: url(../images/unread.png);
    }
  }
  
  .update {
    font-weight: bold;
    margin-bottom: 28px;
    display: none;
    
    a {
      color: #FF4444;
      &:hover { color: #CC0000; }
    }
  }
  
  .jobs {
    margin: 8px;
    padding: 4px;
    
    > p {
      margin: 0;
      margin-bottom: 4px;
      padding-top: 4px;
      padding-bottom: 4px;
      border-bottom: 1px solid #ddd;
    }
  
    .bar {
      height: 28px;
    
      .label {
        height: 16px;
        line-height: 16px;
        margin: 4px 0;
        width: 30%;
        font-size: 11px;
        display: inline-block;
        vertical-align: top;
        text-align: right;
      }
      
      .job {
        vertical-align: top;
        width: 60%;
        display: inline-block;
	      height: 16px;
	      margin: 4px 0;
	      border-radius: 2px;
	      .linear-gradient(top, #f8f8f8, #f1f1f1);
	      box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
	      background: #eee;
	      
	      .progress {
	        height: 16px;
	        border-radius: 2px;
	        max-width: 100%;
	        background: @main-color;
	      }
	    }
    }
  }
  
  p {
    text-align: center;
    color: #444;
  }
  
  ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    margin-left: 15px;
    min-height: 12px;
    
    li {
      padding: 0;
      margin: 0;
      display: block;
      position: relative;
      white-space: nowrap;
      
      a {
        display: block;
        padding: 4px;
        margin-left: 22px;
        
        &:hover {
          ~ .edit {
            display: inline-block;
          }
        }
        
        img {
          display: inline-block;
          vertical-align: middle;
          width: 16px;
          height: 16px;
        }
        
        .name, .title {
          overflow: hidden;
          display: inline-block;
          max-width: 120px;
          text-overflow: ellipsis;
          vertical-align: middle;
        }
        
        .unread-count {
          display: inline-block;
          vertical-align: middle;
        }
      }
      
      &:hover {
        background: #eee;
      }
      
      &.active {
        > a {
          background: #ddd !important;
        }
      }
      
      &.unread {
        > a {
          font-weight: bold;
        }
      }
      
      .collapse {
        position: absolute;
        display: inline-block;
        height: 11px;
        width: 11px;
        top: 9px;
        left: 12px;
        cursor: pointer;
        
        &.opened {
          background: url('../images/tree_minus.gif');
        }
        
        &.closed {
          background: url('../images/tree_plus.gif');
        }
      }
      
      .edit {
        position: absolute;
        display: none;
        height: 16px;
        width: 16px;
        top: 6px;
        right: 4px;
        cursor: pointer;
        background: url('../images/edit.png');
        
        &:hover {
          display: inline-block;
        }
      }
    }
    
    .placeholder {
      border: 1px dashed #aaa;
      margin-left: 20px;
      margin-right: 10px;
    }
  }
}

// Subscriptions backdrop
#subscriptions-backdrop {
  display: none;
}

.qtip-drop-menu {
  width: 200px;
  text-align: center;
  
  input[type="text"] {
    width: 50px;
    margin: 5px;
    margin-left: 0;
  }
  
  .showable {
   margin: 5px;
  }
  
  input[type="text"] {
    width: 120px;
    margin: 0;
  }
  
  input[type="button"] {
    width: 190px;
    margin: 5px;
    display: block;
  }
  
  ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    
    li {
      margin: 0;
      padding: 8px;
      display: block;
      cursor: pointer;
      color: #444;
      font-size: 11px;
      
      &.active {
        background: @main-color !important;
        color: #fff;
      }
      
      &:hover {
        background: #eee;
      }
    }
  }
}

.qtip-subscription-edit {
	.subscription-edit-url {
    font-size: 10px;
	}
}

.qtip-subscription-edit-info {
  width: 400px;
  padding: 10px;

  .subscription-edit-info-table {
    width: 100%;

    th {
      font-weight: bold;
      padding: 6px;
      width: 40%;
    }

    td {
      padding: 6px;
    }
  }

  .subscription-edit-info-synctable-container {
    max-height: 200px;
    overflow-y: auto;
  }

  .subscription-edit-info-synctable {
    width: 100%;
    border: 1px solid #aaa;

    th {
      border: 1px solid #eee;
      padding: 6px;
      font-weight: bold;
    }

    td {
      border: 1px solid #eee;
      padding: 6px;
    }
  }
}

#qtip-category-add {
  text-align: center;
  width: 200px;
  
  input[type="text"] {
    width: 80%;
    margin: 5px;
  }
  
  input[type="submit"] {
    margin: 5px;
  }
}

#qtip-subscription-add {
  text-align: center;
  width: 400px;
  
  input[type="text"] {
    width: 90%;
    margin: 5px;
  }
  
  input[type="submit"] {
    margin: 5px;
  }

  .help {
    display: block;
    margin: 12px;
  }
}

#qtip-settings {
  ul {
    li {
      padding: 0;
      a {
        padding: 8px;
        display: block;
      }
    }
  }
}

.qtip-job .qtip-content {
	text-align: center;
	font-size: 10px;
}

// Feed
#feed {
  background: #f5f5f5;
  
  #toolbar {
    background: #fff;
    border-bottom: 1px solid #ccc;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    padding: 8px;
    height: 27px;
    
    
    
    > .full-button {
      border-left: none;
      border-radius: 0 2px 2px 0;
    }
    
    > .list-button {
      border-radius: 2px 0 0 2px;
      margin-left: 8px;
    }

    > .narrow-article {
      display: none;
    }
    
    > .search-input {
      width: 300px;
      background: url(../images/search.png) no-repeat 3px center;
      text-indent: 18px;
      color: #333;
    }
    
    > .back-button {
      display: inline-block;
    }
    
    > .refresh-button, > .all-button, > .all-read-button, > .settings-button, > .narrow-article {
      margin-left: 8px;
    }
    
    > .full-button, > .list-button, > .settings-button, > .category-button, > .back-button, .narrow-article {
      float: right;
    }
  }
  
  #feed-container {
    outline: none;
  
    &.list {
      > .feed-item {
        margin: 0;
        border-collapse: collapse;
      
        .collapsed {
          display: block;
          height: 40px;
          position: relative;
          
          .feed-item-star {
            display: block;
            position: absolute;
            top: 50%;
            margin-top: -12px;
            left: 7px;
          }
          
          > .feed-item-collapsed-subscription {
            height: 40px;
            line-height: 40px;
            position: absolute;
            left: 38px;
            width: 150px;
            overflow: hidden;
          }
          
          .container {
            position: absolute;
            display: block;
            overflow: hidden;
            left: 200px;
            right: 160px;
            height: 40px;
            cursor: pointer;
            
            > .feed-item-collapsed-subscription {
              display: none;
            }
          }
          
          .feed-item-collapsed-title {
            display: inline;
            line-height: 40px;
          }
          
          .feed-item-collapsed-description {
            display: inline;
            line-height: 40px;
            color: #777;
            margin-left: 8px;
          }
          
          .feed-item-date {
            display: block;
            position: absolute;
            line-height: 40px;
            right: 28px;
          }
          
          .feed-item-collapsed-link {
            display: block;
            position: absolute;
            right: 7px;
            top: 50%;
            margin-top: -8px;
            opacity: 0.4;
          }
        }
        
        .header {
          .feed-item-date {
            display: none;
          }
        }
        
        &.unfolded {
          .collapsed {
            background: #eee;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
            border-bottom: 1px solid #ccc;
          }
        }
        
        &:not(.unfolded) {
          .header {
            display: none;
          }
        
          .content {
            display: none;
          }
          
          .footer {
            display: none;
          }
        }
        
        &:not(.read) {
          .collapsed .feed-item-collapsed-title {
            font-weight: bold;
          }
        }
      }

      > .markread {
        display: block;
        padding: 16px;
        text-align: center;
        font-weight: bold;
        color: @main-color;
        cursor: pointer;
      }
    }
  
    > .feed-item {
      background: #fff;
      margin: 12px;
      border: 1px solid #ddd;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
      overflow: hidden;
      
      &.read {
        border: 1px solid #888;
      }
      
      &.selected {
        border-left: 1px solid @main-color;
      }
      
      .collapsed {
        display: none;
      }
      
      .highlight {
        background: #ff4444;
        color: #fff;
      }
      
      .header {
        padding: 12px;
        vertical-align: top;
        position: relative;
      
        .feed-item-star {
          position: absolute;
          top: 0;
          left: 3px;
          padding: 7px;
          
          &+ .feed-item-title {
            margin-left: 28px;
          }
        }
      
        .feed-item-title {
          display: inline-block;
          margin-right: 130px;
          
          font-size: 140%;
          font-weight: bold;
          color: @main-color;
        }
        
        .feed-item-subscription {
          display: inline-block;
          margin-top: 12px;
          color: #777;
        }
        
        .feed-item-creator {
          display: inline-block;
          margin-top: 8px;
          color: #777;
        }
        
        .feed-item-date {
          position: absolute;
          top: 14px;
          right: 14px;
          color: #777;
        }
      }
      
      .content {
        padding-left: 14px;
        padding-right: 14px;
        
        .feed-item-description {
          iframe {
            border: 1px solid #ccc !important;
          }
          
          img, iframe {
            max-width: 100%;
          }
          
          img {
            height: auto;
            display: block;
            margin: 4px;
          }
        
          &:after {
				    clear: both;
				    display: block;
				    content: " ";
				    visibility: hidden;
				    height: 0;
				  }
        }
      }
      
      .footer {
        margin-top: 14px;
        display: block;
        background: #f8f8f8;
        padding: 14px;
        color: #444;
        
        .feed-item-unread {
          display: inline-block;
          margin-right: 14px;
          vertical-align: middle;
          line-height: 24px;
          height: 24px;
        }
        
        .feed-item-comments {
          display: inline-block;
          margin-right: 14px;
          vertical-align: middle;
          line-height: 24px;
          height: 24px;
        }
        
        .feed-item-enclosure {
          display: inline-block;
          vertical-align: middle;
          line-height: 24px;
          height: 24px;
        }

        .feed-item-share {
          display: inline-block;
          vertical-align: middle;
          line-height: 24px;
          height: 24px;

          img {
            opacity: 0.6;

            &:hover {
              opacity: 1;
            }
          }
        }
      }
      
      .feed-item-star {
        display: inline-block;
        margin-right: 14px;
        vertical-align: middle;
        width: 24px;
        height: 24px;
        cursor: pointer;
        background: url('../images/nostar.png') no-repeat center;
        
        &.starred {
          background: url('../images/star.png') no-repeat center;
        }
      }
    }

    > .markread {
      display: none;
    }
    
    > .bumper {
      height: 1000px;
      position: relative;
      
      .loader {
        display: none;
        position: absolute;
        left: 50%;
        top: 10px;
        margin-left: -8px;
      }
      
      .retry {
        position: absolute;
        display: block;
        left: 0;
        right: 0;
        top: 10px;
        color: #FF4444;
        &:hover { color: #CC0000; }
      }
    }
    
    > .empty, > .bumper {
      text-align: center;
      padding: 100px;
      color: #444;
      font-weight: bold;
      font-size: 16px;
    }
    
    > .empty ~ .bumper {
      display: none;
    }
    
    > .loader {
      text-align: center;
      padding: 100px;
    }
  }
  
  #settings-container {
    h1 {
      font-size: 22px;
      font-variant: small-caps;
      font-weight: 300;
      padding-bottom: 6px;
      padding-left: 8px;
      margin-bottom: 20px;
      margin-top: 24px;
      color: @main-color;
      border-bottom: 1px solid #ddd;
    }
    
    form {
      label {
        span {
          width: 200px;
          display: inline-block;
        }
        
        input[type="text"], input[type="password"], select {
          display: inline-block;
          width: 200px;
        }
      }
      
      input.error, select.error {
        border: 1px solid #ff4444 !important;
      }
      
      label.error {
        margin-left: 10px;
        color: #ff4444;
      }
    }
  }
  
  #about-container {
    padding: 1em 1.4em;
  
    h1 {
      font-size: 22px;
      font-variant: small-caps;
      font-weight: 300;
      padding-bottom: 6px;
      padding-left: 8px;
      margin-bottom: 20px;
      margin-top: 24px;
      color: @main-color;
      border-bottom: 1px solid #ddd;
      
      select {
        position: relative; 
        top: -3px;
      }
      
      .button {
        position: relative;
        top: 7px;
      }
    }
    
    #logs-container {
      height: 500px;
      resize: vertical;
      background: #eee;
      box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
      overflow: auto;
      white-space: nowrap;
      
      #logs-table {
        border-collapse: collapse;
        width: 100%;
      
	      tr.log-item {
	        &.fatal {
	          background: #ddbcee;
	          &:hover { background: darken(#ddbcee, 10%); }
	        }
	        
	        &.error {
	          background: #ffafaf;
	          &:hover { background: darken(#ffafaf, 10%); }
	        }
	        
	        &.warn {
	          background: #ffe3a0;
	          &:hover { background: darken(#ffe3a0, 10%); }
	        }
	        
	        &.info {
	          background: #d3e992;
	          &:hover { background: darken(#d3e992, 10%); }
	        }
	        
	        &.debug, &.trace {
	          background: #a8dff4;
	          &:hover { background: darken(#a8dff4, 10%); }
	        }
	        
	        > td {
	          font: 12px monospace;
	          padding: 3px 6px;
	        }
	      }
      }
    }
  }
  
  #wizard-container {
    padding: 30px;
  
    > h1 {
      font-size: 30px;
      font-weight: 300;
      color: @main-color;
      font-variant: small-caps;
      margin: 0;
    }
  
    > p {
      font-weight: 300;
      margin-bottom: 30px;
    }
    
    > ul {
      list-style-type: none;
      margin: 0;
      padding: 0;
      background: #eee;
      
      li {
        margin: 0;
        padding: 15px;
        display: inline-block;
        cursor: pointer;
        font-weight: 300;
        font-size: 14px;
        
        &:hover {
        background: @main-color;
        color: #fff;
        }
        
        &.active {
          background: #ddd !important;
          color: #000 !important;
        }
      }
    }
    
    .wizard-container {
      padding: 18px;
      display: none;
    }
    
    #wizard-navigation {
      background: #eee;
      padding: 8px;
    }
    
    
    form {
      label {
        span {
          width: 200px;
          display: inline-block;
        }
        
        input[type="text"], input[type="password"], select {
          display: inline-block;
          width: 200px;
        }
      }
      
      input.error, select.error {
        border: 1px solid #ff4444 !important;
      }
      
      label.error {
        margin-left: 10px;
        color: #ff4444;
      }
    }
  }
}

// Media queries overrides
@import "_desktop.less" screen and (min-width: 1024px);
@import "_smartphone.less" screen and (max-width: 1023px);
@import "_smartphone-small.less" screen and (max-width: 446px);

// Visibility override
.hidden {
  display: none !important;
}